# this is the main payment tracker module
# 
# any action that a normal user can perform should
# have a wrapper here

from __init__ import Singleton

from ptObject.user import *
from ptObject.payment import *

class Tracker(object):
    """
    payment tracker class
    This is a singleton class. You can only have one instance of this
    class. However, this shouldn't matter at all, since all other
    ptObject classes are multiton classes
    """
    __metaclass__ = Singleton

    ######## Overridden build-in Methods / Operators ########
    def __init__(self, loginUser):
        pass                    # we do not need to construct anything, yet

    ######## Public Functions ########
    def listUsers(self, group):
        if isinstance(group, Group):
            return [ group.getPayer ] + group.getPayeeList()
        else:
            return User.getAllUsers

    def rename(self, user, newName):
        user.changeName(newName)
        return


    ######## Private Member Functions ########

